/* eslint-disable @typescript-eslint/no-explicit-any */
 
import axios from 'axios';

const instance = axios.create({
  baseURL: 'http://localhost:8080', // 后端基础地址
  timeout: 5000
});

export interface BaseResponse<T = any> {
  code: string
  msg: string
  status:number
  statusText:string
  headers:any
  config:any
  data: T
}

export interface LoginData {
  token?: string
  [key: string]: any
}

export type LoginResponse = BaseResponse<LoginData>


export const getBooks = () => {
  return instance.get('/book/list');
};

export const listCategory = ({}) => {
  return instance.get('/category/list');
};

export const listuser = ({}) => {
  return instance.get('/userlist');
};

export const adminProfile = ({}) => {
  return instance.get('/admin/profile');
};